home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / E-G / Externals.cpt / Externals / card_5689.txt < prev    next >
Text File  |  1989-02-26  |  1KB  |  51 lines

  1. -- card: 5689 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 2795
  5. -- name: NewFileName
  6.  
  7.  
  8. -- part contents for background part 13
  9. ----- text -----
  10. NewFileName - XFCN  
  11.  
  12. "NewFileName" allows your Hypertalk scripts to request a NEW file name from the user.  The functionall optionally accepts a prompt string and optionally accepts a default file name.
  13.  
  14.         NewFileName()   -- no prompt,no default
  15.         NewFileName("Enter a name:")    --prompt, no default
  16.         NewFileName("Enter a name:","MyFile")    --both
  17.  
  18. Examples:
  19.  
  20. on mouseUp
  21.   get NewFileName("New name for this file:", "My file")
  22.   -- name of a file the user picks goes into "it"
  23.   put "You chose to create‚Ķ" & return into bkgnd field 1
  24.   if it is not empty then
  25.     put it after bkgnd field 1
  26.   else    -- we return a null string if user hits Cancel
  27.     put "nothing!" after bkgnd field 1
  28.   end if
  29. end mouseUp
  30.  
  31. on mouseUp
  32.   put NewFileName("New name for this file:", "My file") into theFile
  33.   if theFile is not empty then
  34.     open file theFile
  35.     repeat with i = 1 to 100
  36.       write i & ". " & ¬¨
  37.       "I will not throw food in class." & return to file theFile
  38.     end repeat
  39.     close file theFile
  40.   end if
  41. end mouseUp
  42.  
  43.  
  44.  
  45. -- part contents for background part 1
  46. ----- text -----
  47. XFCN
  48.  
  49. -- part contents for background part 22
  50. ----- text -----
  51. NewFileName("prompt","filename")